package game.asset
{
	import engine.asset.*;
	import engine.core.*;
	import engine.loaders.*;
	import engine.math.*;
	import flash.utils.*;
	import game.core.*;

	public class RxAssetNavNode extends RxAsset
	{
		private var m_nodes:Vector.<RxNode>;
		private var m_numNodes:int;
		private var m_navWidth:int;
		private var m_navHeight:int;
		private var m_navL:Number;
		private var m_navR:Number;
		private var m_navT:Number;
		private var m_navB:Number;
		private var m_offset:RxVector4;
		private var m_loadTime:int = 0;
		private var m_partitionArray:Array;
		private var m_numBinsX:int;
		private var m_numBinsY:int;
		private static var s_type:int;
		public static const PARTITION_TILE_SIZE:Number = 500;
		public static const GRID_SPACING:Number = 50;
		public static const GRID_X_OFFSET:Number = 0;
		public static const GRID_Z_OFFSET:Number = 0;
		public static const GRID_PERTURB:Number = 17;
		public static const AUTOCONNECT_RADIUS:Number = 85;
		
		public function RxAssetNavNode()
		{
			super(s_type);
			this.m_offset = new RxVector4();
		}
		
		public static function GetByName(name:String) : RxAssetNavNode
		{
			return RxAssetNavNode(_getByName(name, s_type));
		}
		
		public function GetNodePos(index:int) : RxVector4
		{
			var node:RxNode = this.m_nodes[index];
			return node.m_pos;
		}
		
		public static function Initialize() : void
		{
			s_type = RxAsset.RegisterType("navnode", CreateFromXML);
		}
		
		public static function CreateFromXML(param1:XML, param2:String) : RxAssetNavNode
		{
			var _loc_3:* = param1.@name;
			var _loc_4:* = param1.@url;
			_loc_4 = RxUtilities.MergePath(param2, _loc_4);
			return Create(_loc_4, _loc_3);
		}
		
		public static function Create(param1:String, param2:String) : RxAssetNavNode
		{
			var _loc_3:* = GetByURL(param1);
			if (_loc_3 != null)
			{
				var _loc_4:* = _loc_3;
				var _loc_5:* = _loc_3.m_references + 1;
				_loc_4.m_references = _loc_5;
				return _loc_3;
			}
			_loc_3 = new RxAssetNavNode;
			_loc_3.SetURL(param1);
			_loc_3.SetName(param2);
			return _loc_3;
		}
		
		public static function GetByURL(param1:String) : RxAssetNavNode
		{
			return RxAssetNavNode(_getByURL(param1, s_type));
		}
	}
}